Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support cjs and esm both by tshy #61

Merged
merged 1 commit into from
Dec 20, 2024
Merged

feat: support cjs and esm both by tshy #61

merged 1 commit into from
Dec 20, 2024

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Dec 20, 2024

BREAKING CHANGE: drop Node.js < 18.19.0 support

part of eggjs/egg#3644

eggjs/egg#5257

Summary by CodeRabbit

  • New Features

    • Introduced a new GitHub Actions workflow for package publishing.
    • Updated the README with new usage examples and a Node.js version badge.
  • Bug Fixes

    • Enhanced error handling and type safety in various functions.
  • Documentation

    • Updated README examples to reflect ES module syntax and modern coding practices.
  • Refactor

    • Transitioned from CommonJS to ES module syntax across multiple files.
    • Improved type annotations and structure in the codebase.
  • Chores

    • Updated ESLint configuration for better modularity.
    • Modified GitHub Actions CI workflow to specify Node.js versions and add code coverage reporting.

BREAKING CHANGE: drop Node.js < 18.19.0 support

part of eggjs/egg#3644

eggjs/egg#5257
Copy link

coderabbitai bot commented Dec 20, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces a comprehensive modernization of the mm package, transitioning from CommonJS to ES modules and TypeScript. The changes span multiple files, updating the project's configuration, build processes, and testing infrastructure. Key modifications include updating ESLint configurations, GitHub Actions workflows, dependency management, and refactoring the source and test files to use modern JavaScript practices with enhanced type safety.

Changes

File Change Summary
.eslintrc Extended ESLint configuration to include TypeScript and node prefix rules
.github/workflows/nodejs.yml Updated Node.js versions, added CodeCov token, modified CI workflow
.github/workflows/pkg.pr.new.yml New workflow for automated package publishing
.gitignore Added entries for package-lock.json, .tshy*, .eslintcache, and dist
README.md Updated usage examples, added Node.js version badge, modernized code snippets
package.json Significant updates to dependencies, scripts, module exports, and Node.js version requirements
src/index.ts Refactored to ES modules with TypeScript type annotations
test/* Transitioned tests to ES modules, updated assertion styles, added type annotations

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant CI as GitHub Actions
    participant Build as Build Process
    participant Test as Test Runner
    participant Publish as Package Registry

    Dev->>CI: Push code
    CI->>Build: Trigger build
    Build->>Build: Install dependencies
    Build->>Test: Run tests
    Test-->>Build: Test results
    alt All Tests Pass
        Build->>Publish: Publish package
    else Tests Fail
        Build->>Dev: Notify failure
    end
Loading

Poem

🐰 A Rabbit's Ode to Modernization 🚀

Modules dance in TypeScript light,
ES imports now shine so bright,
Workflows sing, dependencies gleam,
Our package dances like a dream!
Hop, hop, hurray for clean code's might! 🌟

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8855186 and 8facd3d.

📒 Files selected for processing (17)
  • .eslintrc (1 hunks)
  • .github/workflows/nodejs.yml (1 hunks)
  • .github/workflows/pkg.pr.new.yml (1 hunks)
  • .gitignore (1 hunks)
  • README.md (11 hunks)
  • index.js (0 hunks)
  • lib/es6.js (0 hunks)
  • package.json (1 hunks)
  • src/index.ts (22 hunks)
  • test/async-await.test.ts (6 hunks)
  • test/asyncDispose.test.ts (1 hunks)
  • test/co.js (0 hunks)
  • test/es6.test.ts (2 hunks)
  • test/foo.js (0 hunks)
  • test/foo.ts (1 hunks)
  • test/mm.test.ts (31 hunks)
  • test/thunk.js (0 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

pkg-pr-new bot commented Dec 20, 2024

Open in Stackblitz

npm i https://pkg.pr.new/node-modules/mm@61

commit: 8facd3d

@fengmk2 fengmk2 merged commit f1eadcc into master Dec 20, 2024
21 checks passed
@fengmk2 fengmk2 deleted the egg-v4 branch December 20, 2024 14:56
fengmk2 pushed a commit that referenced this pull request Dec 20, 2024
[skip ci]

## [4.0.0](v3.4.0...v4.0.0) (2024-12-20)

### ⚠ BREAKING CHANGES

* drop Node.js < 18.19.0 support

part of eggjs/egg#3644

eggjs/egg#5257

### Features

* support cjs and esm both by tshy ([#61](#61)) ([f1eadcc](f1eadcc))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant